<!DOCTYPE html> 
<html class="ui-mobile-rendering"> 

<head> 
	<title>Hellogue</title> 
	<meta name="viewport" content="width=device-width, initial-scale=1"> 
	<meta name="viewport" content="width=device-width, user-scalable=no" />
   <meta name="apple-mobile-web-app-capable" content="yes">
   <meta name="apple-mobile-web-app-status-bar-style" content="black">
   <link rel="stylesheet" href="<?echo base_url('themes/jquery.mobile.structure-1.0.1.min.css');?>" />
   <link rel="stylesheet" href="<?echo base_url('themes/hellogue.min.css');?>" />    
   <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
   <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
   <link rel="stylesheet" href="http://dev.jtsage.com/cdn/datebox/1.0.1/jquery.mobile.datebox-1.0.1.css" /> 
   <script src="http://dev.jtsage.com/cdn/datebox/1.0.1/jquery.mobile.datebox-1.0.1.js"></script>

	<script src="<?echo base_url('themes/jquery.easing.1.3.js');?>"></script>
    	<script src="<?echo base_url('themes/jquery.mobile.scrollview.js');?>"></script>
    	<script src="http://cubiq.org/dropbox/iscroll/iscroll.js?v3.7.1"></script>
    	<script src="<?echo base_url('themes/jquery.mobile.iscroll.js');?>"></script>
   
   <?php if (false) :?>
   	<script src="<?echo base_url('themes/scrollview.js');?>"></script>
   <?php endif;?>
    
   <!--Geolocation---------------------------------// -->
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" type="text/javascript"></script>
   <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
   <script type="text/javascript">
		var center;
		var map = null;
		var marker = null;

		function Newinitialize(lat,lng) {
		center = new google.maps.LatLng(lat,lng);
		var myOptions = {
			zoom: 18,	
			center: center,
			mapTypeId: google.maps.MapTypeId.ROADMAP
		}
		var new_lat1 = center.lat();
		var new_longi1 = center.lng();
		map = new google.maps.Map(document.getElementById("map_canvasRoast"), myOptions);

		marker = new google.maps.Marker({
			position: center,
			map: map,
			animation: google.maps.Animation.DROP
		});
		google.maps.event.addListener(map, 'click', function(event) {placeMarker(event.latLng);});
		google.maps.event.addListener(marker, 'click', function() {
					window.location.href = "../hello_controller/choose_place?lat="+new_lat1+"&longi="+new_longi1;} );
		}

		function placeMarker(location) {
    		var clickedLocation = new google.maps.LatLng(location);
    		if(marker){
				marker.setMap(null);
			}
			marker = new google.maps.Marker({
				position: location, 
				map: map,
				animation: google.maps.Animation.DROP
			});
	
		var new_lat = location.lat();
		var new_longi = location.lng();
	  	google.maps.event.addListener(marker, 'click', function() {window.location.href = "../hello_controller/choose_place?lat="+new_lat+"&longi="+new_longi;} );
		};

		function detectBrowser() {
			var useragent = navigator.userAgent;
			var mapdivMap = document.getElementById("map_canvasRoast");

			/*if (useragent.indexOf('iPhone') != -1 || useragent.indexOf('Android') != -1 ) {
				mapdivMap.style.width = '100%';
				mapdivMap.style.height = '100%';
			} 
			else {*/
				mapdivMap.style.width = '600px';
				mapdivMap.style.height = '800px';
			//}
		};

	$(document).ready(function() { $('.goMap').live('click', function() {
		if(navigator.geolocation){
			detectBrowser();
			navigator.geolocation.getCurrentPosition(function(position){
			Newinitialize(position.coords.latitude,position.coords.longitude);
		});
	}else{
		detectBrowser();
		Newinitialize(52.636161,-1.133065);
	}});	});
	</script>
    
	<script type="text/javascript">
	$(document).ready(function() {
  	$('.goMap2').live('click', function() {
		if(navigator.geolocation){
			navigator.geolocation.getCurrentPosition(function(position){
				window.location.href = "../hello_controller/get_around_hello?lat="+position.coords.latitude+"&longi="+position.coords.longitude;
			});
		}else{
			window.location.href = "../hello_controller/get_around_hello?lat="+22.337966+"&longi="+114.264173;
		}});});
	</script>
	
	<script type="text/javascript">
	$(document).ready(function() {
  	$('.goMap4').live('click', function() {
		if(navigator.geolocation){
			navigator.geolocation.getCurrentPosition(function(position){
				window.location.href = "../hello_controller/get_lucky_hello?lat="+position.coords.latitude+"&longi="+position.coords.longitude;
			});
		}
		else{
			window.location.href = "../hello_controller/get_lucky_hello?lat="+22.337966+"&longi="+114.264173;
		}});});
	</script>
	
	<script type="text/javascript">
		var center;
		var map = null;
		var marker = null;

		function Newinitialize3(lat,lng) {
		center = new google.maps.LatLng(lat,lng);
		var myOptions = {
			zoom: 17,	
			center: center,
			mapTypeId: google.maps.MapTypeId.ROADMAP
		}
		map = new google.maps.Map(document.getElementById("map_canvasRoast2"), myOptions);
		
		<?php if(isset($lucky)):?>
		<?php foreach( $lucky as $row):?>
			placeMarker3(<?=$row->lat+mt_rand()%1000/3000000.0?>,<?=$row->longi+mt_rand()%1000/3000000.0?>,<?=$row->helloid?>);
		<?php endforeach;?>
		<?php endif;?>
		}

		function placeMarker3(new_lat,new_longi,helloid) {
			marker = new google.maps.Marker({
				position: new google.maps.LatLng(new_lat,new_longi),
				map: map,
				animation: google.maps.Animation.DROP
		});
	
	  	google.maps.event.addListener(marker, 'click', function() {
	  		window.location.href = "../feed_controller/to_apply?helloID="+helloid;
	  		} );
		};
		
		function detectBrowser3() {
			var useragent = navigator.userAgent;
			var mapdivMap = document.getElementById("map_canvasRoast2");

			/*if (useragent.indexOf('iPhone') != -1 || useragent.indexOf('Android') != -1 ) {
				mapdivMap.style.width = '100%';
				mapdivMap.style.height = '100%';
			} 
			else {*/
				mapdivMap.style.width = '600px';
				mapdivMap.style.height = '800px';
			//}
		};

	$(document).ready(function() {
  	$('.goMap3').live('click', function() {
                                   //alert("fired");
	if(navigator.geolocation){
		detectBrowser3();
		navigator.geolocation.getCurrentPosition(function(position){
		Newinitialize3(position.coords.latitude,position.coords.longitude);
	});}
	else{
		detectBrowser3();
		Newinitialize3(52.636161,-1.133065);
	}});});
	</script>
	
</head> 

<body> 
 	
 	<div id="bodyload" data-role = "page">

<?php if ( $id != "readApplicants" and $id != "confirmed_hello" and $id != "login" and $id != "register" and $id != "me" ): ?>

	
		<div id="header" data-role="header" data-position="fixed">
 		<a data-rel="back" data-role="button" data-icon="back" data-iconpos="left">Back</a>
		<h1><?=$title?></h1>
		<?php if($this->session->userdata('isverified')):?>
				<a href="<?=site_url('hello_controller/to_create_hello');?>" data-role="button" data-icon="createhello" data-iconpos="right">New</a>
		<?php endif;?>
	
		<div data-role="navbar" class="ui-navbar" data-iconpos="left">
		<ul>
			<?php if ($id=="feed"):?>
				<li><a href="<?php echo site_url('feed_controller');?>"  data-role="button" data-icon="world"  class="ui-btn-active ui-state-persist"><b>Feed</b></a></li>
			<?php else: ?>
				<li><a href="<?php echo site_url('feed_controller');?>"  data-transition="slidedown" data-role="button" data-icon="world"><b>Feed</b></a></li>
	    	<?php endif; ?>
	   	<?php if ($id=="notification"):?>
				<li><a href="<?php echo site_url('notification_controller/show_notification');?>" data-role="button" data-icon="notification"  data-inline="true" class="ui-btn-active ui-state-persist"><b>Notice</b></a></li>
			<?php else: ?>
				<li><a href="<?php echo site_url('notification_controller/show_notification');?>" data-role="button" data-icon="notification" data-transition="slidedown" data-inline="true"><b>Notice</b></a></li>
			<?php endif; ?>
		
			<?php if ($id=="message"):?>
				<li><a href="<?php echo site_url('messege_controller/show_my_messege');?>" data-role="button" data-icon="messages"  data-inline="true" class="ui-btn-active ui-state-persist"><b>Message</b></a></li>
			<?php else: ?>
				<li><a href="<?php echo site_url('messege_controller/show_my_messege');?>" data-role="button" data-icon="messages" data-transition="slidedown" data-inline="true"><b>Message</b></a></li>
			<?php endif; ?>
		
			<?php if ($id=="me"):?>
				<li><a href="<?php echo site_url('user_controller/show_user_profile?userID='.$this->session->userdata('userid'));?>" data-role="button" data-icon="me"  data-inline="true" class="ui-btn-active ui-state-persist"><b>Profile</b></a></li>
			<?php else: ?>
				<li><a href="<?php echo site_url('user_controller/show_user_profile?userID='.$this->session->userdata('userid'));?>" data-role="button" data-icon="me" data-transition="slidedown" data-inline="true"><b>Profile</b></a></li>
			<?php endif; ?>
		
			</ul>
		</div><!-- navbar -->
		</div><!-- header -->
	
<?php elseif($id=="me"): ?>
   
   <div data-role="header"  data-position="fixed">			
		<?php if ($rows->userid==$this->session->userdata('userid')) :?>
			<a data-rel="back" data-role="button" data-icon="back" data-iconpos="left">Back</a>
			<h1>My Profile</h1>

			<?php if($this->session->userdata('isverified')):?>
				<a href="<?=site_url('hello_controller/to_create_hello');?>" data-role="button" data-icon="createhello" data-iconpos="right">New</a>
			<?php endif;?>
			
			<div data-role="navbar" data-iconpos="left" >
			<ul>
			<li><a data-theme="b"   href="<?echo site_url('feed_controller/index');?>" data-icon="world"  data-transition="slidedown"><b>Feed</b></a></li>
			<li><a data-theme="b"   href="<?echo site_url('feed_controller/my_hello');?>" data-icon="rss"  data-transition="slidedown"><b>My Hello</b></a></li>
			<li><a data-theme="b"   href="<?php echo site_url('friend_controller/view_my_friends');?>" data-icon="friends" data-transition="slidedown" >Friend</a></li>
			<li><a data-theme="b"  href="<?=site_url('user_controller/to_edit_profile');?>" data-icon="editprofile"  data-transition="slidedown"><b>Edit</b></a></li>	
			</ul>
			</div><!--narvbar-->
		
	<?php else: ?><!-- for dialog -->
			<h4><?=$rows->fullname?></h4>	
	<?php endif; ?>
	</div><!-- header -->

<? elseif ( $id == "readApplicants" ): ?>
	<div data-role="header"  data-position="fixed">	
		<h4>Applicants</h4>
	</div>
	
<? elseif ( $id == "confirmed_hello" ): ?>
	<div data-role="header"  data-position="fixed">	
		<h4>Hello World</h4>
	</div>
	
<? elseif ($id == "register"): ?>
	<div data-role="header"  data-position="fixed">	
		<a href ="<?= site_url('splash_controller');?>" data-role="button" class="ui-brn-left" data-icon="arrow-l">Back</a>
		<h1>Hello World</h1>
	</div>
	
<? else: ?>
<? endif; ?>
	

<?php if (($id=="feed" or $id=="me")and !$this->session->userdata('isverified')): ?>
	<p><b>You haven't verified your account<b></p>	
<?php endif;?>
	
	<a style="display:none;"  data-role="button" id="autoid3" class="goMap3" >??</a>
	<a style="display:none;"  data-role="button" id="autoid2" class="goMap2" >??</a>
	<a style="display:none;"  data-role="button" id="autoid" class="goMap" >??</a>
	<a style="display:none;"  data-role="button" id="autoid4" class="goMap4" >??</a>
	
<?php if ($id == "new"): ?>
	<script>
   	$("#bodyload").ready(function () {$("#autoid").click();});
	</script>
<?php endif; ?>
	
<?php  if ($id == "look_around"): ?>
	<script>
	$("#bodyload").ready(function () {$("#autoid2").click();});
	</script>
<?php endif; ?>
	
<?php  if ($id == "show_around"): ?>
	<script>
		$("#bodyload").ready(function () {$("#autoid3").click();});
	</script>
<?php endif; ?>

<?php  if ($id == "lucky"): ?>
	<script>
		$("#bodyload").ready(function () {$("#autoid4").click();});
	</script>
<?php endif; ?>